package com.hmall.common.feign;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.PutMapping;

@Component
@FeignClient(value = "itemservice",configuration = FeignClientsConfiguration.class)
public interface ItemClient {
    @GetMapping("/item/list")
    PageDTO<Item> getPage(@RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value="size",defaultValue = "20")Integer size);

    @PutMapping(value = "/item")
    Item updateById(@PathVariable(value = "item") Item item);

    @GetMapping("/item/{id}")
    Item listById(@PathVariable("id") Long id);


}
